package com.fengchao.dao;

import com.fengchao.model.OdrOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

/**
 * Created by wangnian 2016/7/7.
 */
@Mapper
public interface OdrOrderMapper {

    /**
     * 根据id 修改为 invalid
     *
     * @param id
     * @return
     */
    @Update("update odr_order set order_status='INVALID' where id=#{id}")
    Integer updateStatusInvalid(Integer id);

    /**
     * 查询状态为待支付时间过期的订单
     *
     * @param date
     * @return
     */
    @Select("select * from  odr_order where order_status='APPLY' and is_deleted=0 and  #{date}>order_expire_time ")
    List<OdrOrder> findOdrOrder(Date date);
}
